<?php

namespace Modules\AuthAdmin\Database\Seeders;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class AuthsTableSeederTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
		$image_id1 = DB::table('auth_images')->insertGetId([
			'url' => '/upload/images/common/logo.png',
			'open' => 1,
			'status'=>1,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		$image_id2 = DB::table('auth_images')->insertGetId([
			'url' => '/upload/images/common/gzh.jpg',
			'open' => 1,
			'status'=>1,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		$image_id3 = DB::table('auth_images')->insertGetId([
			'url' => '/upload/images/common/xcx.jpg',
			'open' => 1,
			'status'=>1,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_configs')->insert([
            'name' => 'LvaCms',
            'image_status' => 1,
            'image_id' => $image_id1,
			'gzh_id' => $image_id2,
			'xcx_id' => $image_id3,
            'about_us' => '1',
			'created_at'=>date('Y-m-d H:i:s')
        ]);
        $group_id = DB::table('auth_groups')->insertGetId([
		'name' => '超级管理员',
		'created_at'=>date('Y-m-d H:i:s'),
		'rules'=>'1|2']);
        DB::table('auth_admins')->insert([
            'username' => 'admin',
            'password' => bcrypt('123456'),
			'group_id' => $group_id,
			'created_at'=>date('Y-m-d H:i:s')
        ]);
		$pid1 = DB::table('auth_rules')->insertGetId([
			'name'=>'站点管理',
			'status'=>1,
			'auth_open'=>1,
			'icon'=>'icon-zhandianguanli',
			'pid'=>0,
			'level'=>1,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		$pid2 = DB::table('auth_rules')->insertGetId([
			'name'=>'权限管理',
			'status'=>1,
			'auth_open'=>1,
			'icon'=>'icon-quanxianguanli',
			'pid'=>$pid1,
			'level'=>2,
			'created_at'=>date('Y-m-d H:i:s')
		]);
/****************************管理员列表******************************************/
		$pid3 = DB::table('auth_rules')->insertGetId([
			'href'=>'auth/auth_admin/index',
			'name'=>'管理员列表',
			'status'=>1,
			'auth_open'=>1,
			'pid'=>$pid2,
			'level'=>3,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_admin/store',
			'name'=>'添加',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_admin/edit',
			'name'=>'编辑页面',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_admin/update',
			'name'=>'编辑提交',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_admin/status',
			'name'=>'调整状态',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_admin/group_list',
			'name'=>'获取权限组',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_admin/update_pwd',
			'name'=>'初始化密码',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
/**********************************权限组列表******************************************/
		$pid3 = DB::table('auth_rules')->insertGetId([
			'href'=>'auth/auth_group/index',
			'name'=>'权限组列表',
			'status'=>1,
			'auth_open'=>1,
			'pid'=>$pid2,
			'level'=>3,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_group/store',
			'name'=>'添加',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_group/edit',
			'name'=>'编辑页面',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_group/update',
			'name'=>'编辑提交',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_group/status',
			'name'=>'调整状态',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_group/access',
			'name'=>'分配权限',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_group/access_update',
			'name'=>'分配权限提交',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
/***********************************权限列表******************************************/
		$pid3 = DB::table('auth_rules')->insertGetId([
			'href'=>'auth/auth_rule/index',
			'name'=>'权限列表',
			'status'=>1,
			'auth_open'=>1,
			'pid'=>$pid2,
			'level'=>3,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_rule/store',
			'name'=>'添加',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_rule/create_sublevel',
			'name'=>'添加子级',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_rule/edit',
			'name'=>'编辑页面',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_rule/update',
			'name'=>'编辑提交',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_rule/status',
			'name'=>'菜单状态',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);	
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_rule/auth_open',
			'name'=>'是否验证权限',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);	
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_rule/sorts',
			'name'=>'排序',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);	
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_rule/destroy',
			'name'=>'删除',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);		
/****************************系统配置******************************************/		
		$pid2 = DB::table('auth_rules')->insertGetId([
			'name'=>'系统配置',
			'status'=>1,
			'auth_open'=>1,
			'icon'=>'icon-xitongpeizhi',
			'pid'=>$pid1,
			'level'=>2,
			'created_at'=>date('Y-m-d H:i:s')
		]);
/****************************系统配置******************************************/
		$pid3 = DB::table('auth_rules')->insertGetId([
			'href'=>'auth/auth_config/index',
			'name'=>'系统配置',
			'status'=>1,
			'auth_open'=>1,
			'pid'=>$pid2,
			'level'=>3,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/auth_config/update',
			'name'=>'提交',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
/***********************************地区列表******************************************/
		$pid3 = DB::table('auth_rules')->insertGetId([
			'href'=>'auth/area/index',
			'name'=>'地区列表',
			'status'=>1,
			'auth_open'=>1,
			'pid'=>$pid2,
			'level'=>3,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/area/store',
			'name'=>'添加',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/area/edit',
			'name'=>'编辑页面',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/area/update',
			'name'=>'编辑提交',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);
		DB::table('auth_rules')->insert([
			'href'=>'auth/area/status',
			'name'=>'状态',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);	
		DB::table('auth_rules')->insert([
			'href'=>'auth/area/sorts',
			'name'=>'排序',
			'status'=>0,
			'auth_open'=>1,
			'pid'=>$pid3,
			'level'=>4,
			'created_at'=>date('Y-m-d H:i:s')
		]);			
    }
}
